package com.bawei.week3.fragment;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import com.bawei.week3.R;
import com.bawei.week3.adapter.PicAdapter;
import com.bawei.week3.entity.PictureEntity;
import com.bawei.week3.utils.ContentUtils;

import java.util.List;

import androidx.fragment.app.Fragment;

/**
 * A simple {@link Fragment} subclass.
 */
public class PictureFragment extends Fragment {
    private GridView gridView;
    private PicAdapter picAdapter;
    private List<PictureEntity> list;


    public PictureFragment() {

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_picture, container, false);
        gridView = inflate.findViewById(R.id.gv);
        list = ContentUtils.getPictures(getContext());
        picAdapter = new PicAdapter(list,getContext());
        gridView.setAdapter(picAdapter);
        return inflate;
    }

}
